//
//  UIButton+Extension.swift
//  HrenryWeibo
//
//  Created by 熊涛 on 16/5/18.
//  Copyright © 2016年 熊涛. All rights reserved.
//

import UIKit


extension UIButton {


    //便利构造函数
    convenience init(title : String, bgImageName : String = "timeline_card_bottom_background", imageName : String, titleColor : UIColor = UIColor.lightGrayColor(), titleFontSize : CGFloat = 12) {
        self.init(type : UIButtonType.Custom)
        
        //设置

        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: bgImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(bgImageName)_highlighted"), forState: UIControlState.Highlighted)
        self.setTitle(title, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(titleFontSize)
        self.setTitleColor(titleColor, forState: UIControlState.Normal)
    }

}